package com.atguigu.spzx.model.exception;

import com.atguigu.spzx.model.common.ResultCodeEnum;
import lombok.Data;

//RuntimeException是运行时异常
//Exception是编译时异常： 出现异常时必须try catch  不能抛出
@Data
public class SpzxException extends RuntimeException{

    private Integer code;
    private String message;
    private Throwable e;

    public SpzxException(ResultCodeEnum resultCodeEnum  , Throwable e){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
        this.e = e;
    }
    public SpzxException(Integer code , String message,Throwable e){
        super(message);
        this.code = code;
        this.message = message;
        this.e = e;
    }

}
